Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor default serial port implementation to avoid event callbacks #1444

Merged
merged 3 commits into from
Jul 1, 2023

Conversation

glopesdev
Copy link
Member

This PR rewrites the default serial port implementation to avoid relying on the DataReceived event. Besides being prone to deadlock on dispose as observed in #1437, the event callbacks for serial port are not available in several implementations, including Mono and Unity3D.

The new implementation uses directly the serial port stream through dedicated service threads that perform blocking reads. These can be interrupted asynchronously by directly calling Dispose from a separate thread, so they afford synchronized disposal without any additional logic. Furthermore, this approach establishes an initial exploration for later generalizing asynchronous line reads over any stream, which can be useful for streaming data from files, network sockets and other data sources.

@glopesdev glopesdev added feature New planned feature proposal Request for a new feature labels Jun 30, 2023
@glopesdev glopesdev added this to the 2.8 milestone Jun 30, 2023
@glopesdev glopesdev merged commit f12bb6c into bonsai-rx:main Jul 1, 2023
2 checks passed
@glopesdev glopesdev deleted the polling-serialport branch July 1, 2023 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New planned feature proposal Request for a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant